package com.moon.utils;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;

public class FileUtils {
    //拷贝文件
    public static void copy(String src, String dest) {
        try {
            //定义流
            InputStream input = new FileInputStream(src);
            OutputStream output = new FileOutputStream(dest);
            //循环读写
            byte[] buf = new byte[1024];
            int len = 0;
            while ((len = input.read(buf)) != -1) {
                output.write(buf, 0, len);
            }
            //关闭流
            output.close();
            input.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    //
}
